﻿#Region "License & Usage"

'Microsoft Public License (Ms-PL) 

'This license governs use of the accompanying software. If you use the 
'software, you accept this license. If you do not accept the license, do 
'not use the software. 

'1. Definitions 

'The terms "reproduce," "reproduction," "derivative works," and 
'"distribution" have the same meaning here as under U.S. copyright law. 

'A "contribution" is the original software, or any additions or changes 
'to the software. 

'A "contributor" is any person that distributes its contribution under 
'this license. 

'"Licensed patents" are a contributor's patent claims that read directly 
'on its contribution. 

'2. Grant of Rights 

'(A) Copyright Grant- Subject to the terms of this license, including the 
'license conditions and limitations in section 3, each contributor grants 
'you a non-exclusive, worldwide, royalty-free copyright license to 
'reproduce its contribution, prepare derivative works of its 
'contribution, and distribute its contribution or any derivative works 
'that you create. 

'(B) Patent Grant- Subject to the terms of this license, including the 
'license conditions and limitations in section 3, each contributor grants 
'you a non-exclusive, worldwide, royalty-free license under its licensed 
'patents to make, have made, use, sell, offer for sale, import, and/or 
'otherwise dispose of its contribution in the software or derivative 
'works of the contribution in the software. 

'3. Conditions and Limitations 

'(A) No Trademark License- This license does not grant you rights to use 
'any contributors' name, logo, or trademarks. 

'(B) If you bring a patent claim against any contributor over patents 
'that you claim are infringed by the software, your patent license from 
'such contributor to the software ends automatically. 

'(C) If you distribute any portion of the software, you must retain all 
'copyright, patent, trademark, and attribution notices that are present 
'in the software. 

'(D) If you distribute any portion of the software in source code form, 
'you may do so only under this license by including a complete copy of 
'this license with your distribution. If you distribute any portion of 
'the software in compiled or object code form, you may only do so under a 
'license that complies with this license. 

'(E) The software is licensed "as-is." You bear the risk of using it. The 
'contributors give no express warranties, guarantees or conditions. You 
'may have additional consumer rights under your local laws which this 
'license cannot change. To the extent permitted under your local laws, 
'the contributors exclude the implied warranties of merchantability, 
'fitness for a particular purpose and non-infringement.

#End Region

#Region "Options"

Option Strict On
Option Explicit On

#End Region

#Region "Imports"

'From .Net Framework 3.5
Imports Microsoft.Drawing
'Imports Microsoft.WindowsMobile.PocketOutlook

'From Custom Classes/Reference
Imports StedySoft.SenseSDK
Imports StedySoft.SenseSDK.DrawingCE
Imports SenseSDKExtended
Imports SenseSDKExtended.DrawingCEEx

#End Region

Public Class frm_main

#Region "Fields"

    'Declare header control to add on top of the form
    Private s_header As SenseHeaderControl = New SenseHeaderControl

    'Declare list control to add below the header control on the form
    Private s_list As SenseListControl = New SenseListControl

    'Decalre path for various things
    Dim path_resources_root As String = System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase.Substring(0, System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase.LastIndexOf("\")) & "\Resources\"

    'Declare path for icon files, also check resolution
    Dim icon_contact As IImage = DrawingCE.SenseAPIs.SenseImage.LoadIImageFromFile(path_resources_root & If(DrawingCE.Resolution.ScreenIsVGA, "contact_vga", "contact_qvga") & ".png")
    Dim icon_registry As IImage = DrawingCE.SenseAPIs.SenseImage.LoadIImageFromFile(path_resources_root & If(DrawingCE.Resolution.ScreenIsVGA, "regedit_vga", "regedit_qvga") & ".png")
    Dim icon_mail As IImage = DrawingCE.SenseAPIs.SenseImage.LoadIImageFromFile(path_resources_root & If(DrawingCE.Resolution.ScreenIsVGA, "mail_vga", "mail_qvga") & ".png")
    Dim icon_exit As IImage = DrawingCE.SenseAPIs.SenseImage.LoadIImageFromFile(path_resources_root & If(DrawingCE.Resolution.ScreenIsVGA, "ExitButton.VGA", "ExitButton.QVGA") & ".png")
    Dim icon_search As IImage = DrawingCE.SenseAPIs.SenseImage.LoadIImageFromFile(path_resources_root & If(DrawingCE.Resolution.ScreenIsVGA, "SearchButton.VGA", "SearchButton.QVGA") & ".png")
    Dim dvd_bg As IImage = DrawingCE.SenseAPIs.SenseImage.LoadIImageFromFile(path_resources_root & If(DrawingCE.Resolution.ScreenIsVGA, "divider_bg2", "divider_bg2") & ".png")

#End Region

#Region "Methods"

    ''' <summary>
    ''' Form Load Event
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks>None</remarks>
    Private Sub frm_main_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load

        'Create header control properties
        s_header.Dock = System.Windows.Forms.DockStyle.Top
        s_header.Location = New System.Drawing.Point(0, 0)
        s_header.Name = "s_header"
        s_header.Size = New System.Drawing.Size(240, 25)
        s_header.TabIndex = 0
        s_header.Text = "SenseSDK Extended Demo"

        'Create list control properties.
        s_list.Dock = System.Windows.Forms.DockStyle.Fill
        s_list.IsSecondaryScrollType = False
        s_list.Location = New System.Drawing.Point(0, 200)
        s_list.MinimumMovement = 15
        s_list.Name = "s_list"
        s_list.ShowScrollIndicator = False
        s_list.TabIndex = 1
        s_list.ThreadSleep = 100
        s_list.TopIndex = 0
        s_list.Velocity = 0.9F
        s_list.Springback = 0.35F

        Try

            'Set the list event handlers
            'AddHandler s_list.OnBeforeShowItemChildren, AddressOf OnBeforeShowItemChildren
            'AddHandler s_list.OnShowItemChildren, AddressOf OnShowItemChildren
            'AddHandler s_list.OnHideItemChildren, AddressOf OnHideItemChildren

        Catch ex As Exception

            'Throw exception if any other error caught
            Throw New Exception(ex.Message)

        End Try

        Try

            'Add list control first on the form
            Me.Controls.Add(s_list)

            'Add header control second on the form
            Me.Controls.Add(s_header)

        Catch ex As Exception

            'Throw exception if any other error caught
            Throw New Exception(ex.Message)

        End Try

        Try

            'Sense list control beginupdates
            s_list.BeginUpdate()

        Catch ex As Exception

            'Throw exception if any other error caught
            Throw New Exception(ex.Message)

        End Try

        Try

            'Add header
            s_list.AddItem(New SensePanelDividerItem("custom_header", ""))

            Dim onoff = New SenseSDKExtended.SensePanelOnOffItemEx.Style1
            onoff.PrimaryText = "Save on exit?"
            onoff.SecondaryText = "This will save on exit if on"
            onoff.LeftText = "No"
            onoff.RightText = "Yes"
            onoff.LeftTextForeColor = Color.Red
            onoff.RightTextForeColor = Color.Green
            onoff.Enabled = False
            s_list.AddItem(onoff)

            Dim onoff2 = New SenseSDKExtended.SensePanelOnOffItemEx.Style1
            onoff2.PrimaryText = "Save on exit?"
            onoff2.PrimaryTextFontName = "Helvetica Neue OTS"
            onoff2.SecondaryText = "This will save on exit if on"
            onoff2.SecondaryTextFontName = "Helvetica Neue OTS"
            onoff2.LeftText = "No"
            onoff2.LeftTextFontName = "Helvetica Neue OTS"
            onoff2.RightText = "Yes"
            onoff2.RightTextFontName = "Helvetica Neue OTS"
            onoff2.LeftTextForeColor = Color.Red
            onoff2.RightTextForeColor = Color.Green
            onoff2.Enabled = True
            s_list.AddItem(onoff2)

            Dim onoff3 = New SenseSDKExtended.SensePanelOnOffItemEx.Style2
            onoff3.PrimaryText = "Save on exit?"
            onoff3.PrimaryTextFontName = "Helvetica Neue OTS"
            onoff3.SecondaryText = "This will save on exit if on"
            onoff3.SecondaryTextFontName = "Helvetica Neue OTS"
            onoff3.Status = ItemStatus.Off
            s_list.AddItem(onoff3)

            Dim sel = New SenseSDKExtended.SensePanelSelectionControl.SelectionStyle1
            sel.FirstDayOfTheWeek = FirstDayOfWeek.Sunday
            sel.Sunday = True
            sel.Monday = True
            sel.Tuesday = True
            sel.Friday = True
            AddHandler sel.OnClickDays, AddressOf sel_OnClickDays
            s_list.AddItem(sel)

            Dim sel2 = New SenseSDKExtended.SensePanelSelectionControl.SelectionStyle2
            sel2.January = True
            sel2.April = True
            sel2.October = True
            AddHandler sel2.OnClickMonths, AddressOf sel_OnClickDays
            s_list.AddItem(sel2)

            '#################################  HeaderControlEx Style 1 - Examples  #################################

            Dim btn_frm_SenseHeaderControlEx_HTCContactsStyle1_1 = New SensePanelButtonItem
            btn_frm_SenseHeaderControlEx_HTCContactsStyle1_1.Text = "HeaderControlEx Style 1 - Example 1"
            AddHandler btn_frm_SenseHeaderControlEx_HTCContactsStyle1_1.OnClick, AddressOf btn_frm_SenseHeaderControlEx_HTCContactsStyle1_1_OnClick
            s_list.AddItem(btn_frm_SenseHeaderControlEx_HTCContactsStyle1_1)

            Dim btn_frm_SenseHeaderControlEx_HTCContactsStyle1_2 = New SensePanelButtonItem
            btn_frm_SenseHeaderControlEx_HTCContactsStyle1_2.Text = "HeaderControlEx Style 1 - Example 2"
            AddHandler btn_frm_SenseHeaderControlEx_HTCContactsStyle1_2.OnClick, AddressOf btn_frm_SenseHeaderControlEx_HTCContactsStyle1_2_OnClick
            s_list.AddItem(btn_frm_SenseHeaderControlEx_HTCContactsStyle1_2)

            Dim btn_frm_SenseHeaderControlEx_HTCContactsStyle1_3 = New SensePanelButtonItem
            btn_frm_SenseHeaderControlEx_HTCContactsStyle1_3.Text = "HeaderControlEx Style 1 - Example 3"
            AddHandler btn_frm_SenseHeaderControlEx_HTCContactsStyle1_3.OnClick, AddressOf btn_frm_SenseHeaderControlEx_HTCContactsStyle1_3_OnClick
            s_list.AddItem(btn_frm_SenseHeaderControlEx_HTCContactsStyle1_3)

            '#################################  HeaderControlEx Style 2 - Examples  #################################

            Dim btn_frm_SenseHeaderControlEx_HTCContactsStyle2_1 = New SensePanelButtonItem
            btn_frm_SenseHeaderControlEx_HTCContactsStyle2_1.Text = "HeaderControlEx Style 2 - Example 1"
            AddHandler btn_frm_SenseHeaderControlEx_HTCContactsStyle2_1.OnClick, AddressOf btn_frm_SenseHeaderControlEx_HTCContactsStyle2_1_OnClick
            s_list.AddItem(btn_frm_SenseHeaderControlEx_HTCContactsStyle2_1)

            Dim btn_frm_SenseHeaderControlEx_HTCContactsStyle2_2 = New SensePanelButtonItem
            btn_frm_SenseHeaderControlEx_HTCContactsStyle2_2.Text = "HeaderControlEx Style 2 - Example 2"
            AddHandler btn_frm_SenseHeaderControlEx_HTCContactsStyle2_2.OnClick, AddressOf btn_frm_SenseHeaderControlEx_HTCContactsStyle2_2_OnClick
            s_list.AddItem(btn_frm_SenseHeaderControlEx_HTCContactsStyle2_2)

            Dim btn_frm_SenseHeaderControlEx_HTCContactsStyle2_3 = New SensePanelButtonItem
            btn_frm_SenseHeaderControlEx_HTCContactsStyle2_3.Text = "HeaderControlEx Style 2 - Example 3"
            AddHandler btn_frm_SenseHeaderControlEx_HTCContactsStyle2_3.OnClick, AddressOf btn_frm_SenseHeaderControlEx_HTCContactsStyle2_3_OnClick
            s_list.AddItem(btn_frm_SenseHeaderControlEx_HTCContactsStyle2_3)

            '################################  SensePanelItemEx Style 1 - Examples  #################################

            Dim btn_frm_SensePanelItemEx_HTCContactsStyle1_1 = New SensePanelButtonItem
            btn_frm_SensePanelItemEx_HTCContactsStyle1_1.Text = "SensePanelItemEx Style 1 - Example 1"
            AddHandler btn_frm_SensePanelItemEx_HTCContactsStyle1_1.OnClick, AddressOf btn_frm_SensePanelItemEx_HTCContactsStyle1_1_OnClick
            s_list.AddItem(btn_frm_SensePanelItemEx_HTCContactsStyle1_1)

            Dim btn_frm_SensePanelItemEx_HTCContactsStyle1_2 = New SensePanelButtonItem
            btn_frm_SensePanelItemEx_HTCContactsStyle1_2.Text = "SensePanelItemEx Style 1 - Example 2"
            AddHandler btn_frm_SensePanelItemEx_HTCContactsStyle1_2.OnClick, AddressOf btn_frm_SensePanelItemEx_HTCContactsStyle1_2_OnClick
            s_list.AddItem(btn_frm_SensePanelItemEx_HTCContactsStyle1_2)

            Dim btn_frm_SensePanelItemEx_HTCContactsStyle1_3 = New SensePanelButtonItem
            btn_frm_SensePanelItemEx_HTCContactsStyle1_3.Text = "SensePanelItemEx Style 1 - Example 3"
            AddHandler btn_frm_SensePanelItemEx_HTCContactsStyle1_3.OnClick, AddressOf btn_frm_SensePanelItemEx_HTCContactsStyle1_3_OnClick
            s_list.AddItem(btn_frm_SensePanelItemEx_HTCContactsStyle1_3)

            Dim btn_frm_SensePanelItemEx_HTCContactsStyle1_4 = New SensePanelButtonItem
            btn_frm_SensePanelItemEx_HTCContactsStyle1_4.Text = "SensePanelItemEx Style 1 - Example 4"
            AddHandler btn_frm_SensePanelItemEx_HTCContactsStyle1_4.OnClick, AddressOf btn_frm_SensePanelItemEx_HTCContactsStyle1_4_OnClick
            s_list.AddItem(btn_frm_SensePanelItemEx_HTCContactsStyle1_4)

            '################################  SensePanelItemEx Style 2 - Examples  #################################

            Dim btn_frm_SensePanelItemEx_HTCContactsStyle2_1 = New SensePanelButtonItem
            btn_frm_SensePanelItemEx_HTCContactsStyle2_1.Text = "SensePanelItemEx Style 2 - Example 1"
            AddHandler btn_frm_SensePanelItemEx_HTCContactsStyle2_1.OnClick, AddressOf btn_frm_SensePanelItemEx_HTCContactsStyle2_1_OnClick
            s_list.AddItem(btn_frm_SensePanelItemEx_HTCContactsStyle2_1)

            Dim btn_frm_SensePanelItemEx_HTCContactsStyle2_2 = New SensePanelButtonItem
            btn_frm_SensePanelItemEx_HTCContactsStyle2_2.Text = "SensePanelItemEx Style 2 - Example 2"
            AddHandler btn_frm_SensePanelItemEx_HTCContactsStyle2_2.OnClick, AddressOf btn_frm_SensePanelItemEx_HTCContactsStyle2_2_OnClick
            s_list.AddItem(btn_frm_SensePanelItemEx_HTCContactsStyle2_2)

            '################################  SensePanelItemEx Style 3 - Examples  #################################

            Dim btn_frm_SensePanelItemEx_HTCContactsStyle3_1 = New SensePanelButtonItem
            btn_frm_SensePanelItemEx_HTCContactsStyle3_1.Text = "SensePanelItemEx Style 3 - Example 1"
            AddHandler btn_frm_SensePanelItemEx_HTCContactsStyle3_1.OnClick, AddressOf btn_frm_SensePanelItemEx_HTCContactsStyle3_1_OnClick
            s_list.AddItem(btn_frm_SensePanelItemEx_HTCContactsStyle3_1)

            Dim btn_frm_SensePanelItemEx_HTCContactsStyle3_2 = New SensePanelButtonItem
            btn_frm_SensePanelItemEx_HTCContactsStyle3_2.Text = "SensePanelItemEx Style 3 - Example 2"
            AddHandler btn_frm_SensePanelItemEx_HTCContactsStyle3_2.OnClick, AddressOf btn_frm_SensePanelItemEx_HTCContactsStyle3_2_OnClick
            s_list.AddItem(btn_frm_SensePanelItemEx_HTCContactsStyle3_2)

            Dim btn_frm_SensePanelItemEx_HTCContactsStyle3_3 = New SensePanelButtonItem
            btn_frm_SensePanelItemEx_HTCContactsStyle3_3.Text = "SensePanelItemEx Style 3 - Example 3"
            AddHandler btn_frm_SensePanelItemEx_HTCContactsStyle3_3.OnClick, AddressOf btn_frm_SensePanelItemEx_HTCContactsStyle3_3_OnClick
            s_list.AddItem(btn_frm_SensePanelItemEx_HTCContactsStyle3_3)

            '################################  SensePanelItemEx Style 4 - Examples  #################################

            Dim btn_frm_SensePanelItemEx_HTCContactsStyle4_1 = New SensePanelButtonItem
            btn_frm_SensePanelItemEx_HTCContactsStyle4_1.Text = "SensePanelItemEx Style 4 - Example 1"
            AddHandler btn_frm_SensePanelItemEx_HTCContactsStyle4_1.OnClick, AddressOf btn_frm_SensePanelItemEx_HTCContactsStyle4_1_OnClick
            s_list.AddItem(btn_frm_SensePanelItemEx_HTCContactsStyle4_1)

            Dim btn_frm_SensePanelItemEx_HTCContactsStyle4_2 = New SensePanelButtonItem
            btn_frm_SensePanelItemEx_HTCContactsStyle4_2.Text = "SensePanelItemEx Style 4 - Example 2"
            AddHandler btn_frm_SensePanelItemEx_HTCContactsStyle4_2.OnClick, AddressOf btn_frm_SensePanelItemEx_HTCContactsStyle4_2_OnClick
            s_list.AddItem(btn_frm_SensePanelItemEx_HTCContactsStyle4_2)

            Dim btn_frm_SensePanelItemEx_HTCContactsStyle4_3 = New SensePanelButtonItem
            btn_frm_SensePanelItemEx_HTCContactsStyle4_3.Text = "SensePanelItemEx Style 4 - Example 3"
            AddHandler btn_frm_SensePanelItemEx_HTCContactsStyle4_3.OnClick, AddressOf btn_frm_SensePanelItemEx_HTCContactsStyle4_3_OnClick
            s_list.AddItem(btn_frm_SensePanelItemEx_HTCContactsStyle4_3)

            Dim btn_frm_SensePanelItemEx_HTCContactsStyle4_4 = New SensePanelButtonItem
            btn_frm_SensePanelItemEx_HTCContactsStyle4_4.Text = "SensePanelItemEx Style 4 - Example 4"
            AddHandler btn_frm_SensePanelItemEx_HTCContactsStyle4_4.OnClick, AddressOf btn_frm_SensePanelItemEx_HTCContactsStyle4_4_OnClick
            s_list.AddItem(btn_frm_SensePanelItemEx_HTCContactsStyle4_4)

            '############################  SensePanelNumericItemEx Style 1 - Examples  ##############################

            Dim btn_frm_SensePanelNumericItemEx_HTC2DigitStyle1_1 = New SensePanelButtonItem
            btn_frm_SensePanelNumericItemEx_HTC2DigitStyle1_1.Text = "SPanelNumericItemEx Style 1 - 2 Digit"
            AddHandler btn_frm_SensePanelNumericItemEx_HTC2DigitStyle1_1.OnClick, AddressOf btn_frm_SensePanelNumericItemEx_HTC2DigitStyle1_1_OnClick
            s_list.AddItem(btn_frm_SensePanelNumericItemEx_HTC2DigitStyle1_1)

            '############################  SensePanelNumericItemEx Style 1 - Examples  ##############################

            Dim btn_frm_SensePanelNumericItemEx_HTC3DigitStyle1_1 = New SensePanelButtonItem
            btn_frm_SensePanelNumericItemEx_HTC3DigitStyle1_1.Text = "SPanelNumericItemEx Style 1 - 3 Digit"
            AddHandler btn_frm_SensePanelNumericItemEx_HTC3DigitStyle1_1.OnClick, AddressOf btn_frm_SensePanelNumericItemEx_HTC3DigitStyle1_1_OnClick
            s_list.AddItem(btn_frm_SensePanelNumericItemEx_HTC3DigitStyle1_1)

            '############################  SensePanelLinkLabel - Examples  ##############################

            Dim btn_frm_SensePanelLinkLabel_1 = New SensePanelButtonItem
            btn_frm_SensePanelLinkLabel_1.Text = "SensePanelLinkLabel 1 - Example 1"
            AddHandler btn_frm_SensePanelLinkLabel_1.OnClick, AddressOf btn_frm_SensePanelLinkLabel_1_OnClick
            s_list.AddItem(btn_frm_SensePanelLinkLabel_1)

            Dim btn_frm_SensePanelLinkLabel_2 = New SensePanelButtonItem
            btn_frm_SensePanelLinkLabel_2.Text = "SensePanelLinkLabel 1 - Example 2"
            AddHandler btn_frm_SensePanelLinkLabel_2.OnClick, AddressOf btn_frm_SensePanelLinkLabel_2_OnClick
            s_list.AddItem(btn_frm_SensePanelLinkLabel_2)

            '############################  SensePanelPictureBox Style 1 - Examples  ##############################

            Dim btn_frm_SensePanelPictureBox_1 = New SensePanelButtonItem
            btn_frm_SensePanelPictureBox_1.Text = "SensePanelPictureBox Style 1 - Example 1"
            AddHandler btn_frm_SensePanelPictureBox_1.OnClick, AddressOf btn_frm_SensePanelPictureBox_1_OnClick
            s_list.AddItem(btn_frm_SensePanelPictureBox_1)

            '############################  SenseInputBox - Examples  ##############################

            Dim btn_SenseInputBox_1 = New SensePanelButtonItem
            btn_SenseInputBox_1.Text = "Open Input Box - Example 1"
            AddHandler btn_SenseInputBox_1.OnClick, AddressOf btn_SenseInputBox_1_OnClick
            s_list.AddItem(btn_SenseInputBox_1)

            Dim btn_SenseInputBox_2 = New SensePanelButtonItem
            btn_SenseInputBox_2.Text = "Open Input Box - Example 2"
            AddHandler btn_SenseInputBox_2.OnClick, AddressOf btn_SenseInputBox_2_OnClick
            s_list.AddItem(btn_SenseInputBox_2)

            Dim btn_SenseInputBox_3 = New SensePanelButtonItem
            btn_SenseInputBox_3.Text = "Open Input Box - Example 3"
            AddHandler btn_SenseInputBox_3.OnClick, AddressOf btn_SenseInputBox_3_OnClick
            s_list.AddItem(btn_SenseInputBox_3)

            '#################################  SensePanelHistogram Style 1 - Examples  #################################

            Dim btn_frm_SensePanelHistogram_Style1_1 = New SensePanelButtonItem
            btn_frm_SensePanelHistogram_Style1_1.Text = "SPanelHistogram - Style 1 - Example 1"
            AddHandler btn_frm_SensePanelHistogram_Style1_1.OnClick, AddressOf btn_frm_SensePanelHistogram_Style1_1_OnClick
            s_list.AddItem(btn_frm_SensePanelHistogram_Style1_1)

            '############################  SenseNumericBox - Examples  ##############################

            Dim btn_SenseNumericBox_1 = New SensePanelButtonItem
            btn_SenseNumericBox_1.Text = "Open Numeric Box - Example 1"
            AddHandler btn_SenseNumericBox_1.OnClick, AddressOf btn_SenseNumericBox_1_OnClick
            s_list.AddItem(btn_SenseNumericBox_1)

            Dim btn_SenseNumericBox_2 = New SensePanelButtonItem
            btn_SenseNumericBox_2.Text = "Open Numeric Box - Example 2"
            AddHandler btn_SenseNumericBox_2.OnClick, AddressOf btn_SenseNumericBox_2_OnClick
            s_list.AddItem(btn_SenseNumericBox_2)

            '########################################################################################################

            'Add footer
            s_list.AddItem(New SensePanelDividerItem("custom_footer", ""))

        Catch ex As Exception

            'Throw exception if any other error caught
            Throw New Exception(ex.Message)

        End Try

        Try

            'End updates of sense list control
            s_list.EndUpdate()

        Catch ex As Exception

            'Throw exception if any other error caught
            Throw New Exception(ex.Message)

        End Try

    End Sub

    Private Sub btn_frm_SenseHeaderControlEx_HTCContactsStyle1_1_OnClick(ByVal sender As Object)

        With New frm_SenseHeaderControlEx_HTCContactsStyle1
            .Tag = "btn_frm_SenseHeaderControlEx_HTCContactsStyle1_1"
            .Show()
        End With

    End Sub

    Private Sub btn_frm_SenseHeaderControlEx_HTCContactsStyle1_2_OnClick(ByVal sender As Object)

        With New frm_SenseHeaderControlEx_HTCContactsStyle1
            .Tag = "btn_frm_SenseHeaderControlEx_HTCContactsStyle1_2"
            .Show()
        End With

    End Sub

    Private Sub btn_frm_SenseHeaderControlEx_HTCContactsStyle1_3_OnClick(ByVal sender As Object)

        With New frm_SenseHeaderControlEx_HTCContactsStyle1
            .Tag = "btn_frm_SenseHeaderControlEx_HTCContactsStyle1_3"
            .Show()
        End With

    End Sub

    Private Sub btn_frm_SenseHeaderControlEx_HTCContactsStyle2_1_OnClick(ByVal sender As Object)

        With New frm_SenseHeaderControlEx_HTCContactsStyle2
            .Tag = "btn_frm_SenseHeaderControlEx_HTCContactsStyle2_1"
            .Show()
        End With

    End Sub

    Private Sub btn_frm_SenseHeaderControlEx_HTCContactsStyle2_2_OnClick(ByVal sender As Object)

        With New frm_SenseHeaderControlEx_HTCContactsStyle2
            .Tag = "btn_frm_SenseHeaderControlEx_HTCContactsStyle2_2"
            .Show()
        End With

    End Sub

    Private Sub btn_frm_SenseHeaderControlEx_HTCContactsStyle2_3_OnClick(ByVal sender As Object)

        With New frm_SenseHeaderControlEx_HTCContactsStyle2
            .Tag = "btn_frm_SenseHeaderControlEx_HTCContactsStyle2_3"
            .Show()
        End With

    End Sub

    Private Sub btn_frm_SensePanelItemEx_HTCContactsStyle1_1_OnClick(ByVal sender As Object)

        With New frm_SensePanelItemEx_HTCContactsStyle1
            .Tag = "btn_frm_SensePanelItemEx_HTCContactsStyle1_1"
            .Show()
        End With

    End Sub

    Private Sub btn_frm_SensePanelItemEx_HTCContactsStyle1_2_OnClick(ByVal sender As Object)

        With New frm_SensePanelItemEx_HTCContactsStyle1
            .Tag = "btn_frm_SensePanelItemEx_HTCContactsStyle1_2"
            .Show()
        End With

    End Sub

    Private Sub btn_frm_SensePanelItemEx_HTCContactsStyle1_3_OnClick(ByVal sender As Object)

        With New frm_SensePanelItemEx_HTCContactsStyle1
            .Tag = "btn_frm_SensePanelItemEx_HTCContactsStyle1_3"
            .Show()
        End With

    End Sub

    Private Sub btn_frm_SensePanelItemEx_HTCContactsStyle1_4_OnClick(ByVal sender As Object)

        With New frm_SensePanelItemEx_HTCContactsStyle1
            .Tag = "btn_frm_SensePanelItemEx_HTCContactsStyle1_4"
            .Show()
        End With

    End Sub

    Private Sub btn_frm_SensePanelItemEx_HTCContactsStyle2_1_OnClick(ByVal sender As Object)

        With New frm_SensePanelItemEx_HTCContactsStyle2
            .Tag = "btn_frm_SensePanelItemEx_HTCContactsStyle2_1"
            .Show()
        End With

    End Sub

    Private Sub btn_frm_SensePanelItemEx_HTCContactsStyle2_2_OnClick(ByVal sender As Object)

        With New frm_SensePanelItemEx_HTCContactsStyle2
            .Tag = "btn_frm_SensePanelItemEx_HTCContactsStyle2_2"
            .Show()
        End With

    End Sub

    Private Sub btn_frm_SensePanelItemEx_HTCContactsStyle3_1_OnClick(ByVal sender As Object)

        With New frm_SensePanelItemEx_HTCContactsStyle3
            .Tag = "btn_frm_SensePanelItemEx_HTCContactsStyle3_1"
            .Show()
        End With

    End Sub

    Private Sub btn_frm_SensePanelItemEx_HTCContactsStyle3_2_OnClick(ByVal sender As Object)

        With New frm_SensePanelItemEx_HTCContactsStyle3
            .Tag = "btn_frm_SensePanelItemEx_HTCContactsStyle3_2"
            .Show()
        End With

    End Sub

    Private Sub btn_frm_SensePanelItemEx_HTCContactsStyle3_3_OnClick(ByVal sender As Object)

        With New frm_SensePanelItemEx_HTCContactsStyle3
            .Tag = "btn_frm_SensePanelItemEx_HTCContactsStyle3_3"
            .Show()
        End With

    End Sub

    Private Sub btn_frm_SensePanelItemEx_HTCContactsStyle4_1_OnClick(ByVal sender As Object)

        With New frm_SensePanelItemEx_HTCContactsStyle4
            .Tag = "btn_frm_SensePanelItemEx_HTCContactsStyle4_1"
            .Show()
        End With

    End Sub

    Private Sub btn_frm_SensePanelItemEx_HTCContactsStyle4_2_OnClick(ByVal sender As Object)

        With New frm_SensePanelItemEx_HTCContactsStyle4
            .Tag = "btn_frm_SensePanelItemEx_HTCContactsStyle4_2"
            .Show()
        End With

    End Sub

    Private Sub btn_frm_SensePanelItemEx_HTCContactsStyle4_3_OnClick(ByVal sender As Object)

        With New frm_SensePanelItemEx_HTCContactsStyle4
            .Tag = "btn_frm_SensePanelItemEx_HTCContactsStyle4_3"
            .Show()
        End With

    End Sub

    Private Sub btn_frm_SensePanelItemEx_HTCContactsStyle4_4_OnClick(ByVal sender As Object)

        With New frm_SensePanelItemEx_HTCContactsStyle4
            .Tag = "btn_frm_SensePanelItemEx_HTCContactsStyle4_4"
            .Show()
        End With

    End Sub

    Private Sub btn_frm_SensePanelNumericItemEx_HTC2DigitStyle1_1_OnClick(ByVal sender As Object)

        With New frm_SensePanelNumericItemEx_HTC2DigitStyle1
            .Tag = "btn_frm_SensePanelNumericItemEx_HTC2DigitStyle1_1"
            .Show()
        End With

    End Sub

    Private Sub btn_frm_SensePanelNumericItemEx_HTC3DigitStyle1_1_OnClick(ByVal sender As Object)

        With New frm_SensePanelNumericItemEx_HTC3DigitStyle1
            .Tag = "btn_frm_SensePanelNumericItemEx_HTC3DigitStyle1_1"
            .Show()
        End With

    End Sub

    Private Sub btn_frm_SensePanelLinkLabel_1_OnClick(ByVal sender As Object)

        With New frm_SensePanelLinkLabel
            .Tag = "btn_frm_SensePanelLinkLabel_1"
            .Show()
        End With

    End Sub

    Private Sub btn_frm_SensePanelLinkLabel_2_OnClick(ByVal sender As Object)

        With New frm_SensePanelLinkLabel
            .Tag = "btn_frm_SensePanelLinkLabel_2"
            .Show()
        End With

    End Sub

    Private Sub btn_frm_SensePanelPictureBox_1_OnClick(ByVal sender As Object)

        With New frm_SensePanelPictureBox_Style1
            .Tag = "btn_frm_SensePanelPictureBox_Style1_1"
            .Show()
        End With

    End Sub

    Private Sub btn_SenseInputBox_1_OnClick(ByVal sender As Object)

        Dim a As String = SenseAPIsEx.SenseInputBox.HTCStyle1.InputBox("""Your most unhappy customers are your greatest source of learning."" Who said this?", "Answer this question.", "Bill Gates")

    End Sub

    Private Sub btn_SenseInputBox_2_OnClick(ByVal sender As Object)

        Dim a As String = SenseAPIsEx.SenseInputBox.HTCStyle2.InputBox("""Your most unhappy customers are your greatest source of learning."" Who said this?", "Answer this question.", "Bill Gates said this. It is very true. We should never forget it.")

    End Sub

    Private Sub btn_SenseInputBox_3_OnClick(ByVal sender As Object)

        Dim _items As ArrayList = New ArrayList
        _items.Add("Dhruwal,Patel")
        _items.Add("James,Johnson")
        _items.Add("One,One")
        _items.Add("Two,Two")
        _items.Add("Three,Three")
        _items.Add("Four,Four")
        _items.Add("Five,Five")
        _items.Add("Six,Six")
        _items.Add("Seven,Seven")
        _items.Add("Eight,Eight")
        _items.Add("Nine,Nine")
        _items.Add("Ten,Ten")

        SenseAPIs.SenseMessageBox.Show(SenseAPIsEx.SenseInputBox.HTCStyle3.InputBox("""Your most unhappy customers are your greatest source of learning."" Who said this?", "Answer this question.", _items, "Four"), "Your Response", SenseMessageBoxButtons.OK)

    End Sub

    Private Sub btn_frm_SensePanelHistogram_Style1_1_OnClick(ByVal sender As Object)

        With New frm_SensePanelHistogram_Style1
            .Tag = "btn_frm_SensePanelHistogram_Style1_1"
            .Show()
        End With

    End Sub

    Private Sub btn_SenseNumericBox_1_OnClick(ByVal sender As Object)

        Dim a As Integer = SenseAPIsEx.SenseNumericBox.HTCStyle1.NumericBox("Select the number...", 0, 0, 50)

    End Sub

    Private Sub btn_SenseNumericBox_2_OnClick(ByVal sender As Object)

        Dim a As Integer = SenseAPIsEx.SenseNumericBox.HTCStyle2.NumericBox("Select the number...", 0, 0, 999)

    End Sub

    Private Sub sel_OnClickDays(ByVal sender As Object, ByVal value As String)

        SenseAPIs.SenseMessageBox.Show(value, "Selected Days", SenseMessageBoxButtons.OK)

    End Sub

    ''' <summary>
    ''' Check if it is VGA or QVGA
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Private Function _isVGA() As Boolean

        Try

            'Return the output
            Return StedySoft.SenseSDK.DrawingCE.Resolution.ScreenIsVGA

        Catch ex As Exception

            'Throw exception if any other error caught
            Throw New Exception(ex.Message)

        End Try

    End Function

    ''' <summary>
    ''' Form Closed Event
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks>None</remarks>
    Private Sub frm_main_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed

        Try

            'Dispose list control and header control
            s_list.Dispose()
            s_header.Dispose()

        Catch ex As Exception

            REM: For debugging purpose only throw this error
            Throw New Exception

        End Try

    End Sub

    ''' <summary>
    ''' Form Closing Event
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks>None</remarks>
    Private Sub frm_main_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing

        Try

            'Remove the list event handlers
            'RemoveHandler s_list.OnBeforeShowItemChildren, AddressOf OnBeforeShowItemChildren
            'RemoveHandler s_list.OnShowItemChildren, AddressOf OnShowItemChildren
            'RemoveHandler s_list.OnHideItemChildren, AddressOf OnHideItemChildren

            'Clear the list control
            s_list.Clear()

        Catch ex As Exception

            If TypeOf ex Is NullReferenceException Then

                'Dont worry about this error.

            End If

        End Try

    End Sub

    ''' <summary>
    ''' Menu Exit Click
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks>None</remarks>
    Private Sub mnuExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuExit.Click

        Try

            'Check if page is morepanelitem
            If mnuExit.Text = "Back" Then

                s_list.ShowParent()

            Else

                'Exit applicaiton
                Me.Close()
                Application.Exit()

            End If

        Catch ex As Exception

            'Throw exception if any other error caught
            Throw New Exception(ex.Message)

        End Try

    End Sub

#End Region

End Class
